package com.cirkana.viewer.share;

import java.io.DataInputStream;
import java.io.DataOutputStream;

import com.cirkana.serial.SerializablePassData;
import com.cirkana.serial.SerializationException;

public class AuthoringTwitterPassData extends SerializablePassData {

	private String url;
	private String pin;

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getPin() {
		return pin;
	}

	public void setPin(String pin) {
		this.pin = pin;
	}

	public AuthoringTwitterPassData() {
	}

	public AuthoringTwitterPassData(String url, String pin) {
		this.url = url;
		this.pin = pin;
	}

	@Override
	public void serialize(DataOutputStream out) throws SerializationException {
		serializeString(this.url, out);
		serializeString(this.pin, out);
	}

	@Override
	public void deserialize(DataInputStream in) throws SerializationException {
		this.url = deserializeString(in);
		this.pin = deserializeString(in);
	}

	@Override
	public String toString() {
		StringBuilder s = new StringBuilder("{");

		s.append("url=");
		if (this.url == null)
			s.append("(null)");
		else
			s.append(this.url);
		s.append(",pin=");
		if (this.pin == null)
			s.append("(null)");
		else
			s.append(this.pin);
		s.append("}");

		return s.toString();
	}
}
